/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAO;
import java.sql.Connection;  
import java.sql.DriverManager;  
import java.sql.SQLException;
/**
 *
 * @author Rodrigo
 */
public class Banco {

    protected Connection connection;  
    protected String url = "localhost/projetofinal";  
    //protected String user = "projeto";  
    //protected String pass = "projetofinal1";  
    protected String user = "root";  
    protected String pass = "1234";  
    //user = radio463_utfpr
    //senha = J0w!V57OQ*TN 
  
       public Banco(){    
             
       }  
    
        public Connection Conecta(){  
  
            try{
               Class.forName("com.mysql.jdbc.Driver");
               connection = DriverManager.getConnection("jdbc:mysql://"+url,user, pass);    
               //System.out.println("Conexao realizada com sucesso.");  
             }  
             catch(SQLException ex){  
              System.out.println("Problemas na conexao com o banco de dados."+ex);  
             }  
             catch(ClassNotFoundException ex){  
               System.out.println("Driver JDBC-ODBC nao encontrado: "+ ex);   
             }  
      
             return connection;  
          
        }  
  
        public void Fecha(){  
        try {
            connection.close();
               //System.out.println("Conexao finalizada com sucesso");  
        } catch (SQLException ex) {
           // Logger.getLogger(Banco.class.getName()).log(Level.SEVERE, null, ex);
        }
        }  

}
